package com.zh.file.service.impl;

import com.zh.file.entity.SysAppendix;
import com.zh.file.mapper.SysAppendixMapper;
import com.zh.file.service.TestTransactional2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Description:
 * @ClassName TestTransactional2ServiceImpl
 * @date: 2021.01.14 14:44
 * @Author: zhanghang
 */
@Service
public class TestTransactional2ServiceImpl implements TestTransactional2Service {

    @Autowired
    private SysAppendixMapper sysAppendixMapper;

    @Override
//    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void testAdd() {
        int a = 1/0;
        SysAppendix sysAppendix = new SysAppendix();
        sysAppendix.setThumbImagePath("123");
        sysAppendix.setFileMd5("123");
        sysAppendix.setBusinessId("123");
        sysAppendix.setFileName("123");
        sysAppendix.setFilePath("123");
        sysAppendix.setPath("123");
        sysAppendix.setGroupName("123");
        sysAppendixMapper.insert(sysAppendix);
    }

    @Override
    public void testNull() {
        System.out.println("======================");
    }
}
